---
const pages = [
  {
    slug: undefined,
    title: "Astro Store",
    text: "Welcome to the Astro store!",
  },
  {
    slug: "products",
    title: "Astro products",
    text: "We have lots of products for you",
  },
  {
    slug: "products/astro-handbook",
    title: "The ultimate Astro handbook",
    text: "If you want to learn Astro, you must read this book.",
  },
];

const { slug } = Astro.params;
const page = pages.find((page) => page.slug === slug);
if (!page) return Astro.redirect("/404");
// if (!page) return Astro.slots.render("404");
const { title, text } = page;
---

<html>
  <head>
    <title>{title}</title>
  </head>
  <body>
    <h1>{title}</h1>
    <p>{text}</p>
  </body>
</html>
